package com.maple.config;

import org.springframework.web.servlet.view.InternalResourceView;

import java.io.File;
import java.util.Locale;

/**
 * @author <a href=mailto:leihuazhe@gmail.com>maple</a>
 * @since 2018-10-21 4:28 PM
 */
public class HtmlResourceView extends InternalResourceView {

    @Override
    public boolean checkResource(Locale locale) {
        File file = new File(this.getServletContext().getRealPath("/") + getUrl());
        // 判断该页面是否存在
        //System.out.println("位置：HtmlResourceView.checkResource ==> " + file.getAbsolutePath() + "[= " + file.exists() + "]");
        return file.exists();
    }
}
